<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head> 
	<title>Videshop Online</title> 
	<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
	<f:view>
		<table border="0" cellpadding="0" cellspacing="10">
			<tr>
				<td colspan="2"><h1>Videoshop Online</h1></td>
			</tr>
			<tr>
				<td valign="top">
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td>
								<!-- User section -->
								<f:subview id="userSection">
									<jsp:include page="user.jsp"/>
								</f:subview>
							</td>
						</tr>
						<tr>
							<td>
								<!-- Category section -->
								<f:subview id="categorySection">
									<jsp:include page="category.jsp"/>
								</f:subview>
							</td>
						</tr>
						<tr>
							<td>
								<!-- Quick search section -->
								<f:subview id="quickSearchSection">
									<jsp:include page="quicksearch.jsp"/>
								</f:subview>
							</td>
						</tr>
					</table>
				</td>
				<td valign="top" class="mainSection">
					<h2>${titleSection.selectedTitle.titleName} (${titleSection.selectedTitle.year})</h2>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td valign="top">
								<h:graphicImage url="#{titleSection.selectedTitle.iconUrl}"/>
								<br/>
								<h:graphicImage url="#{titleSection.selectedTitle.classification.iconUrl}" height="50"/>
							</td>
							<td valign="top">
								<h:outputText styleClass="field" value="#{titleSection.selectedTitle.description}"/>
							</td>
						</tr>
					</table>
					<span class="infoMessage">Available in</span>
					<h:form id="reservationForm">
						<h:dataTable 	id="reservationTable" 
										border="0" cellspacing="0" cellpadding="3"
										value="#{titleSection.selectedTitle.availableMedia}"
										var="medium"
						>
							<h:column>
								<h:graphicImage url="#{medium.mediumType.iconUrl}" height="60px"/>
							</h:column>
							<h:column>
								<c:if test="${!empty userSection.customer}">
									<h:commandLink styleClass="button" action="#{titleSection.reserve}">
										<f:verbatim escape="true">Reserve</f:verbatim>
									</h:commandLink>
								</c:if>
							</h:column>
						</h:dataTable>
					</h:form>
				</td>
			</tr>
		</table>
	</f:view>
</html>